package com.navinfo.opentsp.qingqi.trackoptimize.common.handler;


import com.navinfo.opentsp.qingqi.trackoptimize.common.command.Command;

/**
 * Abstract command handler
 */
public abstract class AbstractCommandHandler<C extends Command<?>, CR extends Command.Result> implements CommandHandler<C, CR> {
    private final Class<C> commandType;
    private final Class<CR> resultType;

    protected AbstractCommandHandler(final Class<C> commandType, final Class<CR> resultType) {
        this.commandType = commandType;
        this.resultType = resultType;
    }

    /**
     * @return command type for routing it to appropriate handler
     */
    public Class<C> getCommandType() {
        return commandType;
    }

    /**
     * @return result type for routing it to appropriate handler
     */
    public Class<CR> getResultType() {
        return resultType;
    }
}
